In [274]:
import numpy as np
import pandas as pd
import math
import cmath
from scipy.optimize import root
import matplotlib.pyplot as plt
%matplotlib inline

In [275]:
print("Hola")


Hola

In [276]:
print("Hola"); print("Bonjour")


Hola
Bonjour

In [277]:
a = "Je m'appelle Agnès"
a


Out[277]:
"Je m'appelle Agnès"

In [278]:
a = "Je m'appelle\
Agnès"
a


Out[278]:
"Je m'appelleAgnès"

In [279]:
a = 0

In [280]:
for i in range(5):
    a+=1
    print(a)


1
2
3
4
5

In [281]:
a = np.array([1,2,3])
a


Out[281]:
array([1, 2, 3])

In [282]:
N,M=100,100
a = np.empty(10000).reshape(N,M)
b = np.random.rand(10000).reshape(N,M)
c = np.random.rand(10000).reshape(N,M)

In [283]:
%%timeit
a = b+c


20.6 µs ± 957 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)

Llaves


In [284]:
from __future__import braces


  File "<ipython-input-284-969d72d3c89b>", line 1
    from __future__import braces
                               ^
SyntaxError: invalid syntax

Indexacion de arrays


In [ ]:
a = np.array([[1,2,3],
    [4,5,6]
])
a

In [ ]:
a[0,0]

In [ ]:
a[0:2,1:3]

In [ ]:
np.zeros((3,4))

In [ ]:
np.identity(5).astype(int)

In [285]:
np.ones((3,4))


Out[285]:
array([[1., 1., 1., 1.],
       [1., 1., 1., 1.],
       [1., 1., 1., 1.]])

In [286]:
np.linspace(0,1,num=10)


Out[286]:
array([0.        , 0.11111111, 0.22222222, 0.33333333, 0.44444444,
       0.55555556, 0.66666667, 0.77777778, 0.88888889, 1.        ])

In [287]:
np.logspace(0,3)


Out[287]:
array([   1.        ,    1.1513954 ,    1.32571137,    1.52641797,
          1.75751062,    2.02358965,    2.32995181,    2.6826958 ,
          3.0888436 ,    3.55648031,    4.09491506,    4.71486636,
          5.42867544,    6.25055193,    7.19685673,    8.28642773,
          9.54095476,   10.98541142,   12.64855217,   14.56348478,
         16.76832937,   19.30697729,   22.22996483,   25.59547923,
         29.47051703,   33.93221772,   39.06939937,   44.98432669,
         51.79474679,   59.63623317,   68.6648845 ,   79.06043211,
         91.0298178 ,  104.81131342,  120.67926406,  138.94954944,
        159.98587196,  184.20699693,  212.09508879,  244.20530945,
        281.1768698 ,  323.74575428,  372.75937203,  429.19342601,
        494.17133613,  568.9866029 ,  655.12855686,  754.31200634,
        868.51137375, 1000.        ])

In [288]:
x = np.linspace(0,1,num=5)
y = np.linspace(0,1,num=5)

xx,yy=np.meshgrid(x,y)

In [289]:
xx,yy


Out[289]:
(array([[0.  , 0.25, 0.5 , 0.75, 1.  ],
        [0.  , 0.25, 0.5 , 0.75, 1.  ],
        [0.  , 0.25, 0.5 , 0.75, 1.  ],
        [0.  , 0.25, 0.5 , 0.75, 1.  ],
        [0.  , 0.25, 0.5 , 0.75, 1.  ]]),
 array([[0.  , 0.  , 0.  , 0.  , 0.  ],
        [0.25, 0.25, 0.25, 0.25, 0.25],
        [0.5 , 0.5 , 0.5 , 0.5 , 0.5 ],
        [0.75, 0.75, 0.75, 0.75, 0.75],
        [1.  , 1.  , 1.  , 1.  , 1.  ]]))

In [290]:
a =np.arange(2*3).reshape(2,3)
a


Out[290]:
array([[0, 1, 2],
       [3, 4, 5]])

In [291]:
np.sqrt(a)


Out[291]:
array([[0.        , 1.        , 1.41421356],
       [1.73205081, 2.        , 2.23606798]])

In [292]:
np.sqrt(np.arange(-3,3))


C:\Users\Agnès\Anaconda3\lib\site-packages\ipykernel_launcher.py:1: RuntimeWarning: invalid value encountered in sqrt
  """Entry point for launching an IPython kernel.
Out[292]:
array([       nan,        nan,        nan, 0.        , 1.        ,
       1.41421356])

In [293]:
np.arange(-3,3).astype(complex)


Out[293]:
array([-3.+0.j, -2.+0.j, -1.+0.j,  0.+0.j,  1.+0.j,  2.+0.j])

In [294]:
np.sqrt(_)


Out[294]:
array([0.        +1.73205081j, 0.        +1.41421356j,
       0.        +1.        j, 0.        +0.        j,
       1.        +0.        j, 1.41421356+0.        j])

In [295]:
a = np.arange(6)
b = np.ones(6).astype(int)
a,b


Out[295]:
(array([0, 1, 2, 3, 4, 5]), array([1, 1, 1, 1, 1, 1]))

In [296]:
a<b


Out[296]:
array([ True, False, False, False, False, False])

In [297]:
np.any(a<b)


Out[297]:
True

In [298]:
np.all(a<b)


Out[298]:
False

In [299]:
a =np.arange(6).astype(float)
b =np.ones(6)
a,b


Out[299]:
(array([0., 1., 2., 3., 4., 5.]), array([1., 1., 1., 1., 1., 1.]))

In [300]:
np.isclose(a,b,rtol=1e-6)


Out[300]:
array([False,  True, False, False, False, False])

In [301]:
np.allclose(a,b,rtol=1e-6)


Out[301]:
False

In [302]:
a = np.zeros((3,4))
a


Out[302]:
array([[0., 0., 0., 0.],
       [0., 0., 0., 0.],
       [0., 0., 0., 0.]])

In [303]:
a[0,:]=1
a


Out[303]:
array([[1., 1., 1., 1.],
       [0., 0., 0., 0.],
       [0., 0., 0., 0.]])

In [304]:
b=np.zeros((3,4))
b[-1]=np.arange(5,9)
b


Out[304]:
array([[0., 0., 0., 0.],
       [0., 0., 0., 0.],
       [5., 6., 7., 8.]])

In [305]:
c = np.ones(10)
c


Out[305]:
array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1.])

In [306]:
c[::2]=2
c


Out[306]:
array([2., 1., 2., 1., 2., 1., 2., 1., 2., 1.])

In [307]:
tablera =np.zeros((8,8))
tablera


Out[307]:
array([[0., 0., 0., 0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0., 0., 0., 0.]])

In [308]:
tablera[:,::2]=1
tablera[::2,1::2]=1
tablera


Out[308]:
array([[1., 1., 1., 1., 1., 1., 1., 1.],
       [1., 0., 1., 0., 1., 0., 1., 0.],
       [1., 1., 1., 1., 1., 1., 1., 1.],
       [1., 0., 1., 0., 1., 0., 1., 0.],
       [1., 1., 1., 1., 1., 1., 1., 1.],
       [1., 0., 1., 0., 1., 0., 1., 0.],
       [1., 1., 1., 1., 1., 1., 1., 1.],
       [1., 0., 1., 0., 1., 0., 1., 0.]])
Matplotlib

In [309]:
plt.plot([0,0.1,0.2,0.5,0.6],[1,-1,0,3,-1])


Out[309]:
[<matplotlib.lines.Line2D at 0x1609c35cbe0>]
$$f(x)$$

In [310]:
def f(x):
    return np.exp(-x**2)

In [311]:
x=np.linspace(-1,5,num=1000)

In [312]:
plt.plot(x,f(x),label="f(x)")
plt.xlabel("x")
plt.ylabel("y")
plt.legend("Fonction x")


Out[312]:
<matplotlib.legend.Legend at 0x1609c3313c8>

In [313]:
x


Out[313]:
array([-1.00000000e+00, -9.93993994e-01, -9.87987988e-01, -9.81981982e-01,
       -9.75975976e-01, -9.69969970e-01, -9.63963964e-01, -9.57957958e-01,
       -9.51951952e-01, -9.45945946e-01, -9.39939940e-01, -9.33933934e-01,
       -9.27927928e-01, -9.21921922e-01, -9.15915916e-01, -9.09909910e-01,
       -9.03903904e-01, -8.97897898e-01, -8.91891892e-01, -8.85885886e-01,
       -8.79879880e-01, -8.73873874e-01, -8.67867868e-01, -8.61861862e-01,
       -8.55855856e-01, -8.49849850e-01, -8.43843844e-01, -8.37837838e-01,
       -8.31831832e-01, -8.25825826e-01, -8.19819820e-01, -8.13813814e-01,
       -8.07807808e-01, -8.01801802e-01, -7.95795796e-01, -7.89789790e-01,
       -7.83783784e-01, -7.77777778e-01, -7.71771772e-01, -7.65765766e-01,
       -7.59759760e-01, -7.53753754e-01, -7.47747748e-01, -7.41741742e-01,
       -7.35735736e-01, -7.29729730e-01, -7.23723724e-01, -7.17717718e-01,
       -7.11711712e-01, -7.05705706e-01, -6.99699700e-01, -6.93693694e-01,
       -6.87687688e-01, -6.81681682e-01, -6.75675676e-01, -6.69669670e-01,
       -6.63663664e-01, -6.57657658e-01, -6.51651652e-01, -6.45645646e-01,
       -6.39639640e-01, -6.33633634e-01, -6.27627628e-01, -6.21621622e-01,
       -6.15615616e-01, -6.09609610e-01, -6.03603604e-01, -5.97597598e-01,
       -5.91591592e-01, -5.85585586e-01, -5.79579580e-01, -5.73573574e-01,
       -5.67567568e-01, -5.61561562e-01, -5.55555556e-01, -5.49549550e-01,
       -5.43543544e-01, -5.37537538e-01, -5.31531532e-01, -5.25525526e-01,
       -5.19519520e-01, -5.13513514e-01, -5.07507508e-01, -5.01501502e-01,
       -4.95495495e-01, -4.89489489e-01, -4.83483483e-01, -4.77477477e-01,
       -4.71471471e-01, -4.65465465e-01, -4.59459459e-01, -4.53453453e-01,
       -4.47447447e-01, -4.41441441e-01, -4.35435435e-01, -4.29429429e-01,
       -4.23423423e-01, -4.17417417e-01, -4.11411411e-01, -4.05405405e-01,
       -3.99399399e-01, -3.93393393e-01, -3.87387387e-01, -3.81381381e-01,
       -3.75375375e-01, -3.69369369e-01, -3.63363363e-01, -3.57357357e-01,
       -3.51351351e-01, -3.45345345e-01, -3.39339339e-01, -3.33333333e-01,
       -3.27327327e-01, -3.21321321e-01, -3.15315315e-01, -3.09309309e-01,
       -3.03303303e-01, -2.97297297e-01, -2.91291291e-01, -2.85285285e-01,
       -2.79279279e-01, -2.73273273e-01, -2.67267267e-01, -2.61261261e-01,
       -2.55255255e-01, -2.49249249e-01, -2.43243243e-01, -2.37237237e-01,
       -2.31231231e-01, -2.25225225e-01, -2.19219219e-01, -2.13213213e-01,
       -2.07207207e-01, -2.01201201e-01, -1.95195195e-01, -1.89189189e-01,
       -1.83183183e-01, -1.77177177e-01, -1.71171171e-01, -1.65165165e-01,
       -1.59159159e-01, -1.53153153e-01, -1.47147147e-01, -1.41141141e-01,
       -1.35135135e-01, -1.29129129e-01, -1.23123123e-01, -1.17117117e-01,
       -1.11111111e-01, -1.05105105e-01, -9.90990991e-02, -9.30930931e-02,
       -8.70870871e-02, -8.10810811e-02, -7.50750751e-02, -6.90690691e-02,
       -6.30630631e-02, -5.70570571e-02, -5.10510511e-02, -4.50450450e-02,
       -3.90390390e-02, -3.30330330e-02, -2.70270270e-02, -2.10210210e-02,
       -1.50150150e-02, -9.00900901e-03, -3.00300300e-03,  3.00300300e-03,
        9.00900901e-03,  1.50150150e-02,  2.10210210e-02,  2.70270270e-02,
        3.30330330e-02,  3.90390390e-02,  4.50450450e-02,  5.10510511e-02,
        5.70570571e-02,  6.30630631e-02,  6.90690691e-02,  7.50750751e-02,
        8.10810811e-02,  8.70870871e-02,  9.30930931e-02,  9.90990991e-02,
        1.05105105e-01,  1.11111111e-01,  1.17117117e-01,  1.23123123e-01,
        1.29129129e-01,  1.35135135e-01,  1.41141141e-01,  1.47147147e-01,
        1.53153153e-01,  1.59159159e-01,  1.65165165e-01,  1.71171171e-01,
        1.77177177e-01,  1.83183183e-01,  1.89189189e-01,  1.95195195e-01,
        2.01201201e-01,  2.07207207e-01,  2.13213213e-01,  2.19219219e-01,
        2.25225225e-01,  2.31231231e-01,  2.37237237e-01,  2.43243243e-01,
        2.49249249e-01,  2.55255255e-01,  2.61261261e-01,  2.67267267e-01,
        2.73273273e-01,  2.79279279e-01,  2.85285285e-01,  2.91291291e-01,
        2.97297297e-01,  3.03303303e-01,  3.09309309e-01,  3.15315315e-01,
        3.21321321e-01,  3.27327327e-01,  3.33333333e-01,  3.39339339e-01,
        3.45345345e-01,  3.51351351e-01,  3.57357357e-01,  3.63363363e-01,
        3.69369369e-01,  3.75375375e-01,  3.81381381e-01,  3.87387387e-01,
        3.93393393e-01,  3.99399399e-01,  4.05405405e-01,  4.11411411e-01,
        4.17417417e-01,  4.23423423e-01,  4.29429429e-01,  4.35435435e-01,
        4.41441441e-01,  4.47447447e-01,  4.53453453e-01,  4.59459459e-01,
        4.65465465e-01,  4.71471471e-01,  4.77477477e-01,  4.83483483e-01,
        4.89489489e-01,  4.95495495e-01,  5.01501502e-01,  5.07507508e-01,
        5.13513514e-01,  5.19519520e-01,  5.25525526e-01,  5.31531532e-01,
        5.37537538e-01,  5.43543544e-01,  5.49549550e-01,  5.55555556e-01,
        5.61561562e-01,  5.67567568e-01,  5.73573574e-01,  5.79579580e-01,
        5.85585586e-01,  5.91591592e-01,  5.97597598e-01,  6.03603604e-01,
        6.09609610e-01,  6.15615616e-01,  6.21621622e-01,  6.27627628e-01,
        6.33633634e-01,  6.39639640e-01,  6.45645646e-01,  6.51651652e-01,
        6.57657658e-01,  6.63663664e-01,  6.69669670e-01,  6.75675676e-01,
        6.81681682e-01,  6.87687688e-01,  6.93693694e-01,  6.99699700e-01,
        7.05705706e-01,  7.11711712e-01,  7.17717718e-01,  7.23723724e-01,
        7.29729730e-01,  7.35735736e-01,  7.41741742e-01,  7.47747748e-01,
        7.53753754e-01,  7.59759760e-01,  7.65765766e-01,  7.71771772e-01,
        7.77777778e-01,  7.83783784e-01,  7.89789790e-01,  7.95795796e-01,
        8.01801802e-01,  8.07807808e-01,  8.13813814e-01,  8.19819820e-01,
        8.25825826e-01,  8.31831832e-01,  8.37837838e-01,  8.43843844e-01,
        8.49849850e-01,  8.55855856e-01,  8.61861862e-01,  8.67867868e-01,
        8.73873874e-01,  8.79879880e-01,  8.85885886e-01,  8.91891892e-01,
        8.97897898e-01,  9.03903904e-01,  9.09909910e-01,  9.15915916e-01,
        9.21921922e-01,  9.27927928e-01,  9.33933934e-01,  9.39939940e-01,
        9.45945946e-01,  9.51951952e-01,  9.57957958e-01,  9.63963964e-01,
        9.69969970e-01,  9.75975976e-01,  9.81981982e-01,  9.87987988e-01,
        9.93993994e-01,  1.00000000e+00,  1.00600601e+00,  1.01201201e+00,
        1.01801802e+00,  1.02402402e+00,  1.03003003e+00,  1.03603604e+00,
        1.04204204e+00,  1.04804805e+00,  1.05405405e+00,  1.06006006e+00,
        1.06606607e+00,  1.07207207e+00,  1.07807808e+00,  1.08408408e+00,
        1.09009009e+00,  1.09609610e+00,  1.10210210e+00,  1.10810811e+00,
        1.11411411e+00,  1.12012012e+00,  1.12612613e+00,  1.13213213e+00,
        1.13813814e+00,  1.14414414e+00,  1.15015015e+00,  1.15615616e+00,
        1.16216216e+00,  1.16816817e+00,  1.17417417e+00,  1.18018018e+00,
        1.18618619e+00,  1.19219219e+00,  1.19819820e+00,  1.20420420e+00,
        1.21021021e+00,  1.21621622e+00,  1.22222222e+00,  1.22822823e+00,
        1.23423423e+00,  1.24024024e+00,  1.24624625e+00,  1.25225225e+00,
        1.25825826e+00,  1.26426426e+00,  1.27027027e+00,  1.27627628e+00,
        1.28228228e+00,  1.28828829e+00,  1.29429429e+00,  1.30030030e+00,
        1.30630631e+00,  1.31231231e+00,  1.31831832e+00,  1.32432432e+00,
        1.33033033e+00,  1.33633634e+00,  1.34234234e+00,  1.34834835e+00,
        1.35435435e+00,  1.36036036e+00,  1.36636637e+00,  1.37237237e+00,
        1.37837838e+00,  1.38438438e+00,  1.39039039e+00,  1.39639640e+00,
        1.40240240e+00,  1.40840841e+00,  1.41441441e+00,  1.42042042e+00,
        1.42642643e+00,  1.43243243e+00,  1.43843844e+00,  1.44444444e+00,
        1.45045045e+00,  1.45645646e+00,  1.46246246e+00,  1.46846847e+00,
        1.47447447e+00,  1.48048048e+00,  1.48648649e+00,  1.49249249e+00,
        1.49849850e+00,  1.50450450e+00,  1.51051051e+00,  1.51651652e+00,
        1.52252252e+00,  1.52852853e+00,  1.53453453e+00,  1.54054054e+00,
        1.54654655e+00,  1.55255255e+00,  1.55855856e+00,  1.56456456e+00,
        1.57057057e+00,  1.57657658e+00,  1.58258258e+00,  1.58858859e+00,
        1.59459459e+00,  1.60060060e+00,  1.60660661e+00,  1.61261261e+00,
        1.61861862e+00,  1.62462462e+00,  1.63063063e+00,  1.63663664e+00,
        1.64264264e+00,  1.64864865e+00,  1.65465465e+00,  1.66066066e+00,
        1.66666667e+00,  1.67267267e+00,  1.67867868e+00,  1.68468468e+00,
        1.69069069e+00,  1.69669670e+00,  1.70270270e+00,  1.70870871e+00,
        1.71471471e+00,  1.72072072e+00,  1.72672673e+00,  1.73273273e+00,
        1.73873874e+00,  1.74474474e+00,  1.75075075e+00,  1.75675676e+00,
        1.76276276e+00,  1.76876877e+00,  1.77477477e+00,  1.78078078e+00,
        1.78678679e+00,  1.79279279e+00,  1.79879880e+00,  1.80480480e+00,
        1.81081081e+00,  1.81681682e+00,  1.82282282e+00,  1.82882883e+00,
        1.83483483e+00,  1.84084084e+00,  1.84684685e+00,  1.85285285e+00,
        1.85885886e+00,  1.86486486e+00,  1.87087087e+00,  1.87687688e+00,
        1.88288288e+00,  1.88888889e+00,  1.89489489e+00,  1.90090090e+00,
        1.90690691e+00,  1.91291291e+00,  1.91891892e+00,  1.92492492e+00,
        1.93093093e+00,  1.93693694e+00,  1.94294294e+00,  1.94894895e+00,
        1.95495495e+00,  1.96096096e+00,  1.96696697e+00,  1.97297297e+00,
        1.97897898e+00,  1.98498498e+00,  1.99099099e+00,  1.99699700e+00,
        2.00300300e+00,  2.00900901e+00,  2.01501502e+00,  2.02102102e+00,
        2.02702703e+00,  2.03303303e+00,  2.03903904e+00,  2.04504505e+00,
        2.05105105e+00,  2.05705706e+00,  2.06306306e+00,  2.06906907e+00,
        2.07507508e+00,  2.08108108e+00,  2.08708709e+00,  2.09309309e+00,
        2.09909910e+00,  2.10510511e+00,  2.11111111e+00,  2.11711712e+00,
        2.12312312e+00,  2.12912913e+00,  2.13513514e+00,  2.14114114e+00,
        2.14714715e+00,  2.15315315e+00,  2.15915916e+00,  2.16516517e+00,
        2.17117117e+00,  2.17717718e+00,  2.18318318e+00,  2.18918919e+00,
        2.19519520e+00,  2.20120120e+00,  2.20720721e+00,  2.21321321e+00,
        2.21921922e+00,  2.22522523e+00,  2.23123123e+00,  2.23723724e+00,
        2.24324324e+00,  2.24924925e+00,  2.25525526e+00,  2.26126126e+00,
        2.26726727e+00,  2.27327327e+00,  2.27927928e+00,  2.28528529e+00,
        2.29129129e+00,  2.29729730e+00,  2.30330330e+00,  2.30930931e+00,
        2.31531532e+00,  2.32132132e+00,  2.32732733e+00,  2.33333333e+00,
        2.33933934e+00,  2.34534535e+00,  2.35135135e+00,  2.35735736e+00,
        2.36336336e+00,  2.36936937e+00,  2.37537538e+00,  2.38138138e+00,
        2.38738739e+00,  2.39339339e+00,  2.39939940e+00,  2.40540541e+00,
        2.41141141e+00,  2.41741742e+00,  2.42342342e+00,  2.42942943e+00,
        2.43543544e+00,  2.44144144e+00,  2.44744745e+00,  2.45345345e+00,
        2.45945946e+00,  2.46546547e+00,  2.47147147e+00,  2.47747748e+00,
        2.48348348e+00,  2.48948949e+00,  2.49549550e+00,  2.50150150e+00,
        2.50750751e+00,  2.51351351e+00,  2.51951952e+00,  2.52552553e+00,
        2.53153153e+00,  2.53753754e+00,  2.54354354e+00,  2.54954955e+00,
        2.55555556e+00,  2.56156156e+00,  2.56756757e+00,  2.57357357e+00,
        2.57957958e+00,  2.58558559e+00,  2.59159159e+00,  2.59759760e+00,
        2.60360360e+00,  2.60960961e+00,  2.61561562e+00,  2.62162162e+00,
        2.62762763e+00,  2.63363363e+00,  2.63963964e+00,  2.64564565e+00,
        2.65165165e+00,  2.65765766e+00,  2.66366366e+00,  2.66966967e+00,
        2.67567568e+00,  2.68168168e+00,  2.68768769e+00,  2.69369369e+00,
        2.69969970e+00,  2.70570571e+00,  2.71171171e+00,  2.71771772e+00,
        2.72372372e+00,  2.72972973e+00,  2.73573574e+00,  2.74174174e+00,
        2.74774775e+00,  2.75375375e+00,  2.75975976e+00,  2.76576577e+00,
        2.77177177e+00,  2.77777778e+00,  2.78378378e+00,  2.78978979e+00,
        2.79579580e+00,  2.80180180e+00,  2.80780781e+00,  2.81381381e+00,
        2.81981982e+00,  2.82582583e+00,  2.83183183e+00,  2.83783784e+00,
        2.84384384e+00,  2.84984985e+00,  2.85585586e+00,  2.86186186e+00,
        2.86786787e+00,  2.87387387e+00,  2.87987988e+00,  2.88588589e+00,
        2.89189189e+00,  2.89789790e+00,  2.90390390e+00,  2.90990991e+00,
        2.91591592e+00,  2.92192192e+00,  2.92792793e+00,  2.93393393e+00,
        2.93993994e+00,  2.94594595e+00,  2.95195195e+00,  2.95795796e+00,
        2.96396396e+00,  2.96996997e+00,  2.97597598e+00,  2.98198198e+00,
        2.98798799e+00,  2.99399399e+00,  3.00000000e+00,  3.00600601e+00,
        3.01201201e+00,  3.01801802e+00,  3.02402402e+00,  3.03003003e+00,
        3.03603604e+00,  3.04204204e+00,  3.04804805e+00,  3.05405405e+00,
        3.06006006e+00,  3.06606607e+00,  3.07207207e+00,  3.07807808e+00,
        3.08408408e+00,  3.09009009e+00,  3.09609610e+00,  3.10210210e+00,
        3.10810811e+00,  3.11411411e+00,  3.12012012e+00,  3.12612613e+00,
        3.13213213e+00,  3.13813814e+00,  3.14414414e+00,  3.15015015e+00,
        3.15615616e+00,  3.16216216e+00,  3.16816817e+00,  3.17417417e+00,
        3.18018018e+00,  3.18618619e+00,  3.19219219e+00,  3.19819820e+00,
        3.20420420e+00,  3.21021021e+00,  3.21621622e+00,  3.22222222e+00,
        3.22822823e+00,  3.23423423e+00,  3.24024024e+00,  3.24624625e+00,
        3.25225225e+00,  3.25825826e+00,  3.26426426e+00,  3.27027027e+00,
        3.27627628e+00,  3.28228228e+00,  3.28828829e+00,  3.29429429e+00,
        3.30030030e+00,  3.30630631e+00,  3.31231231e+00,  3.31831832e+00,
        3.32432432e+00,  3.33033033e+00,  3.33633634e+00,  3.34234234e+00,
        3.34834835e+00,  3.35435435e+00,  3.36036036e+00,  3.36636637e+00,
        3.37237237e+00,  3.37837838e+00,  3.38438438e+00,  3.39039039e+00,
        3.39639640e+00,  3.40240240e+00,  3.40840841e+00,  3.41441441e+00,
        3.42042042e+00,  3.42642643e+00,  3.43243243e+00,  3.43843844e+00,
        3.44444444e+00,  3.45045045e+00,  3.45645646e+00,  3.46246246e+00,
        3.46846847e+00,  3.47447447e+00,  3.48048048e+00,  3.48648649e+00,
        3.49249249e+00,  3.49849850e+00,  3.50450450e+00,  3.51051051e+00,
        3.51651652e+00,  3.52252252e+00,  3.52852853e+00,  3.53453453e+00,
        3.54054054e+00,  3.54654655e+00,  3.55255255e+00,  3.55855856e+00,
        3.56456456e+00,  3.57057057e+00,  3.57657658e+00,  3.58258258e+00,
        3.58858859e+00,  3.59459459e+00,  3.60060060e+00,  3.60660661e+00,
        3.61261261e+00,  3.61861862e+00,  3.62462462e+00,  3.63063063e+00,
        3.63663664e+00,  3.64264264e+00,  3.64864865e+00,  3.65465465e+00,
        3.66066066e+00,  3.66666667e+00,  3.67267267e+00,  3.67867868e+00,
        3.68468468e+00,  3.69069069e+00,  3.69669670e+00,  3.70270270e+00,
        3.70870871e+00,  3.71471471e+00,  3.72072072e+00,  3.72672673e+00,
        3.73273273e+00,  3.73873874e+00,  3.74474474e+00,  3.75075075e+00,
        3.75675676e+00,  3.76276276e+00,  3.76876877e+00,  3.77477477e+00,
        3.78078078e+00,  3.78678679e+00,  3.79279279e+00,  3.79879880e+00,
        3.80480480e+00,  3.81081081e+00,  3.81681682e+00,  3.82282282e+00,
        3.82882883e+00,  3.83483483e+00,  3.84084084e+00,  3.84684685e+00,
        3.85285285e+00,  3.85885886e+00,  3.86486486e+00,  3.87087087e+00,
        3.87687688e+00,  3.88288288e+00,  3.88888889e+00,  3.89489489e+00,
        3.90090090e+00,  3.90690691e+00,  3.91291291e+00,  3.91891892e+00,
        3.92492492e+00,  3.93093093e+00,  3.93693694e+00,  3.94294294e+00,
        3.94894895e+00,  3.95495495e+00,  3.96096096e+00,  3.96696697e+00,
        3.97297297e+00,  3.97897898e+00,  3.98498498e+00,  3.99099099e+00,
        3.99699700e+00,  4.00300300e+00,  4.00900901e+00,  4.01501502e+00,
        4.02102102e+00,  4.02702703e+00,  4.03303303e+00,  4.03903904e+00,
        4.04504505e+00,  4.05105105e+00,  4.05705706e+00,  4.06306306e+00,
        4.06906907e+00,  4.07507508e+00,  4.08108108e+00,  4.08708709e+00,
        4.09309309e+00,  4.09909910e+00,  4.10510511e+00,  4.11111111e+00,
        4.11711712e+00,  4.12312312e+00,  4.12912913e+00,  4.13513514e+00,
        4.14114114e+00,  4.14714715e+00,  4.15315315e+00,  4.15915916e+00,
        4.16516517e+00,  4.17117117e+00,  4.17717718e+00,  4.18318318e+00,
        4.18918919e+00,  4.19519520e+00,  4.20120120e+00,  4.20720721e+00,
        4.21321321e+00,  4.21921922e+00,  4.22522523e+00,  4.23123123e+00,
        4.23723724e+00,  4.24324324e+00,  4.24924925e+00,  4.25525526e+00,
        4.26126126e+00,  4.26726727e+00,  4.27327327e+00,  4.27927928e+00,
        4.28528529e+00,  4.29129129e+00,  4.29729730e+00,  4.30330330e+00,
        4.30930931e+00,  4.31531532e+00,  4.32132132e+00,  4.32732733e+00,
        4.33333333e+00,  4.33933934e+00,  4.34534535e+00,  4.35135135e+00,
        4.35735736e+00,  4.36336336e+00,  4.36936937e+00,  4.37537538e+00,
        4.38138138e+00,  4.38738739e+00,  4.39339339e+00,  4.39939940e+00,
        4.40540541e+00,  4.41141141e+00,  4.41741742e+00,  4.42342342e+00,
        4.42942943e+00,  4.43543544e+00,  4.44144144e+00,  4.44744745e+00,
        4.45345345e+00,  4.45945946e+00,  4.46546547e+00,  4.47147147e+00,
        4.47747748e+00,  4.48348348e+00,  4.48948949e+00,  4.49549550e+00,
        4.50150150e+00,  4.50750751e+00,  4.51351351e+00,  4.51951952e+00,
        4.52552553e+00,  4.53153153e+00,  4.53753754e+00,  4.54354354e+00,
        4.54954955e+00,  4.55555556e+00,  4.56156156e+00,  4.56756757e+00,
        4.57357357e+00,  4.57957958e+00,  4.58558559e+00,  4.59159159e+00,
        4.59759760e+00,  4.60360360e+00,  4.60960961e+00,  4.61561562e+00,
        4.62162162e+00,  4.62762763e+00,  4.63363363e+00,  4.63963964e+00,
        4.64564565e+00,  4.65165165e+00,  4.65765766e+00,  4.66366366e+00,
        4.66966967e+00,  4.67567568e+00,  4.68168168e+00,  4.68768769e+00,
        4.69369369e+00,  4.69969970e+00,  4.70570571e+00,  4.71171171e+00,
        4.71771772e+00,  4.72372372e+00,  4.72972973e+00,  4.73573574e+00,
        4.74174174e+00,  4.74774775e+00,  4.75375375e+00,  4.75975976e+00,
        4.76576577e+00,  4.77177177e+00,  4.77777778e+00,  4.78378378e+00,
        4.78978979e+00,  4.79579580e+00,  4.80180180e+00,  4.80780781e+00,
        4.81381381e+00,  4.81981982e+00,  4.82582583e+00,  4.83183183e+00,
        4.83783784e+00,  4.84384384e+00,  4.84984985e+00,  4.85585586e+00,
        4.86186186e+00,  4.86786787e+00,  4.87387387e+00,  4.87987988e+00,
        4.88588589e+00,  4.89189189e+00,  4.89789790e+00,  4.90390390e+00,
        4.90990991e+00,  4.91591592e+00,  4.92192192e+00,  4.92792793e+00,
        4.93393393e+00,  4.93993994e+00,  4.94594595e+00,  4.95195195e+00,
        4.95795796e+00,  4.96396396e+00,  4.96996997e+00,  4.97597598e+00,
        4.98198198e+00,  4.98798799e+00,  4.99399399e+00,  5.00000000e+00])

In [314]:
f(x)


Out[314]:
array([3.67879441e-01, 3.72311630e-01, 3.76770035e-01, 3.81254323e-01,
       3.85764150e-01, 3.90299166e-01, 3.94859006e-01, 3.99443301e-01,
       4.04051668e-01, 4.08683716e-01, 4.13339045e-01, 4.18017244e-01,
       4.22717894e-01, 4.27440565e-01, 4.32184817e-01, 4.36950202e-01,
       4.41736262e-01, 4.46542528e-01, 4.51368524e-01, 4.56213762e-01,
       4.61077746e-01, 4.65959971e-01, 4.70859921e-01, 4.75777073e-01,
       4.80710892e-01, 4.85660836e-01, 4.90626353e-01, 4.95606882e-01,
       5.00601854e-01, 5.05610689e-01, 5.10632801e-01, 5.15667592e-01,
       5.20714457e-01, 5.25772784e-01, 5.30841950e-01, 5.35921324e-01,
       5.41010269e-01, 5.46108136e-01, 5.51214272e-01, 5.56328013e-01,
       5.61448688e-01, 5.66575620e-01, 5.71708122e-01, 5.76845501e-01,
       5.81987056e-01, 5.87132079e-01, 5.92279855e-01, 5.97429662e-01,
       6.02580772e-01, 6.07732450e-01, 6.12883954e-01, 6.18034535e-01,
       6.23183441e-01, 6.28329911e-01, 6.33473179e-01, 6.38612473e-01,
       6.43747019e-01, 6.48876032e-01, 6.53998726e-01, 6.59114310e-01,
       6.64221986e-01, 6.69320954e-01, 6.74410408e-01, 6.79489539e-01,
       6.84557533e-01, 6.89613574e-01, 6.94656840e-01, 6.99686509e-01,
       7.04701753e-01, 7.09701743e-01, 7.14685646e-01, 7.19652628e-01,
       7.24601853e-01, 7.29532481e-01, 7.34443672e-01, 7.39334585e-01,
       7.44204375e-01, 7.49052201e-01, 7.53877215e-01, 7.58678574e-01,
       7.63455431e-01, 7.68206940e-01, 7.72932257e-01, 7.77630537e-01,
       7.82300934e-01, 7.86942606e-01, 7.91554711e-01, 7.96136408e-01,
       8.00686857e-01, 8.05205222e-01, 8.09690669e-01, 8.14142364e-01,
       8.18559478e-01, 8.22941184e-01, 8.27286659e-01, 8.31595084e-01,
       8.35865641e-01, 8.40097519e-01, 8.44289909e-01, 8.48442008e-01,
       8.52553018e-01, 8.56622145e-01, 8.60648600e-01, 8.64631601e-01,
       8.68570369e-01, 8.72464136e-01, 8.76312134e-01, 8.80113607e-01,
       8.83867803e-01, 8.87573976e-01, 8.91231391e-01, 8.94839317e-01,
       8.98397032e-01, 9.01903823e-01, 9.05358983e-01, 9.08761815e-01,
       9.12111631e-01, 9.15407751e-01, 9.18649505e-01, 9.21836232e-01,
       9.24967279e-01, 9.28042006e-01, 9.31059781e-01, 9.34019982e-01,
       9.36921999e-01, 9.39765232e-01, 9.42549091e-01, 9.45272998e-01,
       9.47936386e-01, 9.50538700e-01, 9.53079397e-01, 9.55557944e-01,
       9.57973822e-01, 9.60326524e-01, 9.62615554e-01, 9.64840430e-01,
       9.67000682e-01, 9.69095853e-01, 9.71125501e-01, 9.73089194e-01,
       9.74986516e-01, 9.76817063e-01, 9.78580445e-01, 9.80276287e-01,
       9.81904226e-01, 9.83463915e-01, 9.84955020e-01, 9.86377222e-01,
       9.87730216e-01, 9.89013712e-01, 9.90227433e-01, 9.91371120e-01,
       9.92444526e-01, 9.93447421e-01, 9.94379587e-01, 9.95240825e-01,
       9.96030948e-01, 9.96749786e-01, 9.97397183e-01, 9.97973001e-01,
       9.98477114e-01, 9.98909414e-01, 9.99269807e-01, 9.99558214e-01,
       9.99774575e-01, 9.99918841e-01, 9.99990982e-01, 9.99990982e-01,
       9.99918841e-01, 9.99774575e-01, 9.99558214e-01, 9.99269807e-01,
       9.98909414e-01, 9.98477114e-01, 9.97973001e-01, 9.97397183e-01,
       9.96749786e-01, 9.96030948e-01, 9.95240825e-01, 9.94379587e-01,
       9.93447421e-01, 9.92444526e-01, 9.91371120e-01, 9.90227433e-01,
       9.89013712e-01, 9.87730216e-01, 9.86377222e-01, 9.84955020e-01,
       9.83463915e-01, 9.81904226e-01, 9.80276287e-01, 9.78580445e-01,
       9.76817063e-01, 9.74986516e-01, 9.73089194e-01, 9.71125501e-01,
       9.69095853e-01, 9.67000682e-01, 9.64840430e-01, 9.62615554e-01,
       9.60326524e-01, 9.57973822e-01, 9.55557944e-01, 9.53079397e-01,
       9.50538700e-01, 9.47936386e-01, 9.45272998e-01, 9.42549091e-01,
       9.39765232e-01, 9.36921999e-01, 9.34019982e-01, 9.31059781e-01,
       9.28042006e-01, 9.24967279e-01, 9.21836232e-01, 9.18649505e-01,
       9.15407751e-01, 9.12111631e-01, 9.08761815e-01, 9.05358983e-01,
       9.01903823e-01, 8.98397032e-01, 8.94839317e-01, 8.91231391e-01,
       8.87573976e-01, 8.83867803e-01, 8.80113607e-01, 8.76312134e-01,
       8.72464136e-01, 8.68570369e-01, 8.64631601e-01, 8.60648600e-01,
       8.56622145e-01, 8.52553018e-01, 8.48442008e-01, 8.44289909e-01,
       8.40097519e-01, 8.35865641e-01, 8.31595084e-01, 8.27286659e-01,
       8.22941184e-01, 8.18559478e-01, 8.14142364e-01, 8.09690669e-01,
       8.05205222e-01, 8.00686857e-01, 7.96136408e-01, 7.91554711e-01,
       7.86942606e-01, 7.82300934e-01, 7.77630537e-01, 7.72932257e-01,
       7.68206940e-01, 7.63455431e-01, 7.58678574e-01, 7.53877215e-01,
       7.49052201e-01, 7.44204375e-01, 7.39334585e-01, 7.34443672e-01,
       7.29532481e-01, 7.24601853e-01, 7.19652628e-01, 7.14685646e-01,
       7.09701743e-01, 7.04701753e-01, 6.99686509e-01, 6.94656840e-01,
       6.89613574e-01, 6.84557533e-01, 6.79489539e-01, 6.74410408e-01,
       6.69320954e-01, 6.64221986e-01, 6.59114310e-01, 6.53998726e-01,
       6.48876032e-01, 6.43747019e-01, 6.38612473e-01, 6.33473179e-01,
       6.28329911e-01, 6.23183441e-01, 6.18034535e-01, 6.12883954e-01,
       6.07732450e-01, 6.02580772e-01, 5.97429662e-01, 5.92279855e-01,
       5.87132079e-01, 5.81987056e-01, 5.76845501e-01, 5.71708122e-01,
       5.66575620e-01, 5.61448688e-01, 5.56328013e-01, 5.51214272e-01,
       5.46108136e-01, 5.41010269e-01, 5.35921324e-01, 5.30841950e-01,
       5.25772784e-01, 5.20714457e-01, 5.15667592e-01, 5.10632801e-01,
       5.05610689e-01, 5.00601854e-01, 4.95606882e-01, 4.90626353e-01,
       4.85660836e-01, 4.80710892e-01, 4.75777073e-01, 4.70859921e-01,
       4.65959971e-01, 4.61077746e-01, 4.56213762e-01, 4.51368524e-01,
       4.46542528e-01, 4.41736262e-01, 4.36950202e-01, 4.32184817e-01,
       4.27440565e-01, 4.22717894e-01, 4.18017244e-01, 4.13339045e-01,
       4.08683716e-01, 4.04051668e-01, 3.99443301e-01, 3.94859006e-01,
       3.90299166e-01, 3.85764150e-01, 3.81254323e-01, 3.76770035e-01,
       3.72311630e-01, 3.67879441e-01, 3.63473792e-01, 3.59094996e-01,
       3.54743358e-01, 3.50419174e-01, 3.46122728e-01, 3.41854296e-01,
       3.37614145e-01, 3.33402533e-01, 3.29219707e-01, 3.25065906e-01,
       3.20941358e-01, 3.16846285e-01, 3.12780897e-01, 3.08745396e-01,
       3.04739976e-01, 3.00764819e-01, 2.96820101e-01, 2.92905989e-01,
       2.89022639e-01, 2.85170200e-01, 2.81348813e-01, 2.77558609e-01,
       2.73799711e-01, 2.70072234e-01, 2.66376284e-01, 2.62711960e-01,
       2.59079351e-01, 2.55478539e-01, 2.51909599e-01, 2.48372596e-01,
       2.44867589e-01, 2.41394628e-01, 2.37953757e-01, 2.34545011e-01,
       2.31168418e-01, 2.27823998e-01, 2.24511767e-01, 2.21231729e-01,
       2.17983884e-01, 2.14768225e-01, 2.11584738e-01, 2.08433402e-01,
       2.05314189e-01, 2.02227065e-01, 1.99171989e-01, 1.96148916e-01,
       1.93157792e-01, 1.90198557e-01, 1.87271149e-01, 1.84375494e-01,
       1.81511518e-01, 1.78679138e-01, 1.75878267e-01, 1.73108811e-01,
       1.70370673e-01, 1.67663748e-01, 1.64987929e-01, 1.62343102e-01,
       1.59729149e-01, 1.57145946e-01, 1.54593367e-01, 1.52071279e-01,
       1.49579545e-01, 1.47118025e-01, 1.44686574e-01, 1.42285042e-01,
       1.39913277e-01, 1.37571122e-01, 1.35258416e-01, 1.32974996e-01,
       1.30720693e-01, 1.28495336e-01, 1.26298751e-01, 1.24130760e-01,
       1.21991183e-01, 1.19879835e-01, 1.17796531e-01, 1.15741081e-01,
       1.13713293e-01, 1.11712971e-01, 1.09739920e-01, 1.07793940e-01,
       1.05874828e-01, 1.03982381e-01, 1.02116394e-01, 1.00276657e-01,
       9.84629610e-02, 9.66750946e-02, 9.49128442e-02, 9.31759948e-02,
       9.14643298e-02, 8.97776314e-02, 8.81156802e-02, 8.64782556e-02,
       8.48651361e-02, 8.32760987e-02, 8.17109196e-02, 8.01693743e-02,
       7.86512370e-02, 7.71562816e-02, 7.56842810e-02, 7.42350077e-02,
       7.28082335e-02, 7.14037299e-02, 7.00212681e-02, 6.86606187e-02,
       6.73215523e-02, 6.60038393e-02, 6.47072501e-02, 6.34315549e-02,
       6.21765240e-02, 6.09419279e-02, 5.97275371e-02, 5.85331226e-02,
       5.73584554e-02, 5.62033070e-02, 5.50674493e-02, 5.39506547e-02,
       5.28526961e-02, 5.17733470e-02, 5.07123814e-02, 4.96695742e-02,
       4.86447008e-02, 4.76375376e-02, 4.66478616e-02, 4.56754510e-02,
       4.47200846e-02, 4.37815424e-02, 4.28596052e-02, 4.19540550e-02,
       4.10646748e-02, 4.01912488e-02, 3.93335624e-02, 3.84914021e-02,
       3.76645557e-02, 3.68528123e-02, 3.60559621e-02, 3.52737970e-02,
       3.45061099e-02, 3.37526954e-02, 3.30133493e-02, 3.22878689e-02,
       3.15760532e-02, 3.08777023e-02, 3.01926182e-02, 2.95206042e-02,
       2.88614654e-02, 2.82150083e-02, 2.75810410e-02, 2.69593734e-02,
       2.63498169e-02, 2.57521847e-02, 2.51662915e-02, 2.45919539e-02,
       2.40289900e-02, 2.34772198e-02, 2.29364649e-02, 2.24065488e-02,
       2.18872966e-02, 2.13785352e-02, 2.08800933e-02, 2.03918014e-02,
       1.99134918e-02, 1.94449985e-02, 1.89861573e-02, 1.85368061e-02,
       1.80967841e-02, 1.76659327e-02, 1.72440950e-02, 1.68311159e-02,
       1.64268421e-02, 1.60311221e-02, 1.56438063e-02, 1.52647469e-02,
       1.48937977e-02, 1.45308147e-02, 1.41756553e-02, 1.38281790e-02,
       1.34882470e-02, 1.31557222e-02, 1.28304695e-02, 1.25123553e-02,
       1.22012481e-02, 1.18970179e-02, 1.15995367e-02, 1.13086780e-02,
       1.10243172e-02, 1.07463314e-02, 1.04745995e-02, 1.02090021e-02,
       9.94942149e-03, 9.69574159e-03, 9.44784813e-03, 9.20562846e-03,
       8.96897163e-03, 8.73776834e-03, 8.51191092e-03, 8.29129337e-03,
       8.07581129e-03, 7.86536191e-03, 7.65984404e-03, 7.45915809e-03,
       7.26320605e-03, 7.07189145e-03, 6.88511938e-03, 6.70279647e-03,
       6.52483086e-03, 6.35113218e-03, 6.18161159e-03, 6.01618169e-03,
       5.85475656e-03, 5.69725172e-03, 5.54358413e-03, 5.39367216e-03,
       5.24743559e-03, 5.10479558e-03, 4.96567466e-03, 4.82999674e-03,
       4.69768705e-03, 4.56867214e-03, 4.44287989e-03, 4.32023947e-03,
       4.20068133e-03, 4.08413718e-03, 3.97053998e-03, 3.85982393e-03,
       3.75192444e-03, 3.64677812e-03, 3.54432277e-03, 3.44449738e-03,
       3.34724206e-03, 3.25249809e-03, 3.16020785e-03, 3.07031485e-03,
       2.98276369e-03, 2.89750004e-03, 2.81447063e-03, 2.73362325e-03,
       2.65490672e-03, 2.57827087e-03, 2.50366653e-03, 2.43104555e-03,
       2.36036070e-03, 2.29156575e-03, 2.22461540e-03, 2.15946526e-03,
       2.09607189e-03, 2.03439273e-03, 1.97438609e-03, 1.91601118e-03,
       1.85922806e-03, 1.80399761e-03, 1.75028157e-03, 1.69804247e-03,
       1.64724366e-03, 1.59784928e-03, 1.54982422e-03, 1.50313417e-03,
       1.45774553e-03, 1.41362545e-03, 1.37074182e-03, 1.32906321e-03,
       1.28855891e-03, 1.24919889e-03, 1.21095379e-03, 1.17379489e-03,
       1.13769417e-03, 1.10262419e-03, 1.06855816e-03, 1.03546992e-03,
       1.00333387e-03, 9.72125043e-04, 9.41819018e-04, 9.12391957e-04,
       8.83820578e-04, 8.56082143e-04, 8.29154449e-04, 8.03015818e-04,
       7.77645089e-04, 7.53021603e-04, 7.29125194e-04, 7.05936184e-04,
       6.83435367e-04, 6.61604002e-04, 6.40423804e-04, 6.19876934e-04,
       5.99945990e-04, 5.80613998e-04, 5.61864401e-04, 5.43681055e-04,
       5.26048215e-04, 5.08950530e-04, 4.92373033e-04, 4.76301133e-04,
       4.60720608e-04, 4.45617596e-04, 4.30978585e-04, 4.16790412e-04,
       4.03040247e-04, 3.89715592e-04, 3.76804269e-04, 3.64294417e-04,
       3.52174483e-04, 3.40433212e-04, 3.29059648e-04, 3.18043118e-04,
       3.07373232e-04, 2.97039876e-04, 2.87033200e-04, 2.77343620e-04,
       2.67961805e-04, 2.58878675e-04, 2.50085394e-04, 2.41573364e-04,
       2.33334219e-04, 2.25359821e-04, 2.17642253e-04, 2.10173814e-04,
       2.02947014e-04, 1.95954569e-04, 1.89189396e-04, 1.82644608e-04,
       1.76313508e-04, 1.70189588e-04, 1.64266520e-04, 1.58538153e-04,
       1.52998509e-04, 1.47641780e-04, 1.42462321e-04, 1.37454646e-04,
       1.32613428e-04, 1.27933490e-04, 1.23409804e-04, 1.19037486e-04,
       1.14811792e-04, 1.10728117e-04, 1.06781988e-04, 1.02969062e-04,
       9.92851235e-05, 9.57260793e-05, 9.22879569e-05, 8.89669002e-05,
       8.57591672e-05, 8.26611264e-05, 7.96692542e-05, 7.67801316e-05,
       7.39904418e-05, 7.12969674e-05, 6.86965872e-05, 6.61862744e-05,
       6.37630932e-05, 6.14241968e-05, 5.91668249e-05, 5.69883010e-05,
       5.48860306e-05, 5.28574984e-05, 5.09002665e-05, 4.90119717e-05,
       4.71903242e-05, 4.54331047e-05, 4.37381630e-05, 4.21034157e-05,
       4.05268444e-05, 3.90064940e-05, 3.75404706e-05, 3.61269398e-05,
       3.47641254e-05, 3.34503070e-05, 3.21838189e-05, 3.09630485e-05,
       2.97864343e-05, 2.86524649e-05, 2.75596775e-05, 2.65066559e-05,
       2.54920298e-05, 2.45144731e-05, 2.35727026e-05, 2.26654767e-05,
       2.17915944e-05, 2.09498938e-05, 2.01392509e-05, 1.93585786e-05,
       1.86068257e-05, 1.78829754e-05, 1.71860448e-05, 1.65150832e-05,
       1.58691718e-05, 1.52474221e-05, 1.46489756e-05, 1.40730022e-05,
       1.35186998e-05, 1.29852932e-05, 1.24720334e-05, 1.19781966e-05,
       1.15030836e-05, 1.10460190e-05, 1.06063502e-05, 1.01834470e-05,
       9.77670071e-06, 9.38552351e-06, 9.00934777e-06, 8.64762541e-06,
       8.29982728e-06, 7.96544254e-06, 7.64397805e-06, 7.33495783e-06,
       7.03792250e-06, 6.75242870e-06, 6.47804860e-06, 6.21436939e-06,
       5.96099278e-06, 5.71753452e-06, 5.48362393e-06, 5.25890346e-06,
       5.04302826e-06, 4.83566575e-06, 4.63649520e-06, 4.44520734e-06,
       4.26150399e-06, 4.08509767e-06, 3.91571123e-06, 3.75307755e-06,
       3.59693912e-06, 3.44704779e-06, 3.30316440e-06, 3.16505851e-06,
       3.03250807e-06, 2.90529914e-06, 2.78322562e-06, 2.66608898e-06,
       2.55369799e-06, 2.44586846e-06, 2.34242302e-06, 2.24319086e-06,
       2.14800750e-06, 2.05671459e-06, 1.96915967e-06, 1.88519598e-06,
       1.80468224e-06, 1.72748248e-06, 1.65346584e-06, 1.58250639e-06,
       1.51448294e-06, 1.44927889e-06, 1.38678206e-06, 1.32688453e-06,
       1.26948249e-06, 1.21447609e-06, 1.16176929e-06, 1.11126972e-06,
       1.06288857e-06, 1.01654045e-06, 9.72143236e-07, 9.29617993e-07,
       8.88888835e-07, 8.49882819e-07, 8.12529835e-07, 7.76762501e-07,
       7.42516066e-07, 7.09728305e-07, 6.78339435e-07, 6.48292016e-07,
       6.19530866e-07, 5.92002980e-07, 5.65657441e-07, 5.40445351e-07,
       5.16319745e-07, 4.93235526e-07, 4.71149392e-07, 4.50019764e-07,
       4.29806727e-07, 4.10471963e-07, 3.91978689e-07, 3.74291600e-07,
       3.57376816e-07, 3.41201818e-07, 3.25735406e-07, 3.10947640e-07,
       2.96809797e-07, 2.83294319e-07, 2.70374774e-07, 2.58025804e-07,
       2.46223091e-07, 2.34943312e-07, 2.24164100e-07, 2.13864010e-07,
       2.04022477e-07, 1.94619789e-07, 1.85637044e-07, 1.77056127e-07,
       1.68859673e-07, 1.61031040e-07, 1.53554277e-07, 1.46414102e-07,
       1.39595868e-07, 1.33085546e-07, 1.26869691e-07, 1.20935428e-07,
       1.15270420e-07, 1.09862853e-07, 1.04701412e-07, 9.97752609e-08,
       9.50740237e-08, 9.05877651e-08, 8.63069727e-08, 8.22225404e-08,
       7.83257506e-08, 7.46082595e-08, 7.10620808e-08, 6.76795714e-08,
       6.44534171e-08, 6.13766193e-08, 5.84424814e-08, 5.56445967e-08,
       5.29768364e-08, 5.04333374e-08, 4.80084921e-08, 4.56969369e-08,
       4.34935426e-08, 4.13934042e-08, 3.93918315e-08, 3.74843402e-08,
       3.56666431e-08, 3.39346419e-08, 3.22844188e-08, 3.07122294e-08,
       2.92144948e-08, 2.77877951e-08, 2.64288619e-08, 2.51345726e-08,
       2.39019435e-08, 2.27281242e-08, 2.16103919e-08, 2.05461454e-08,
       1.95329007e-08, 1.85682850e-08, 1.76500326e-08, 1.67759801e-08,
       1.59440614e-08, 1.51523042e-08, 1.43988257e-08, 1.36818283e-08,
       1.29995963e-08, 1.23504921e-08, 1.17329529e-08, 1.11454873e-08,
       1.05866721e-08, 1.00551495e-08, 9.54962394e-09, 9.06885954e-09,
       8.61167735e-09, 8.17695283e-09, 7.76361344e-09, 7.37063630e-09,
       6.99704599e-09, 6.64191241e-09, 6.30434871e-09, 5.98350941e-09,
       5.67858849e-09, 5.38881762e-09, 5.11346446e-09, 4.85183101e-09,
       4.60325208e-09, 4.36709378e-09, 4.14275211e-09, 3.92965156e-09,
       3.72724387e-09, 3.53500671e-09, 3.35244254e-09, 3.17907748e-09,
       3.01446017e-09, 2.85816078e-09, 2.70977000e-09, 2.56889807e-09,
       2.43517391e-09, 2.30824424e-09, 2.18777274e-09, 2.07343928e-09,
       1.96493915e-09, 1.86198233e-09, 1.76429285e-09, 1.67160808e-09,
       1.58367813e-09, 1.50026522e-09, 1.42114317e-09, 1.34609681e-09,
       1.27492143e-09, 1.20742237e-09, 1.14341447e-09, 1.08272164e-09,
       1.02517644e-09, 9.70619664e-10, 9.18899939e-10, 8.69873355e-10,
       8.23403107e-10, 7.79359158e-10, 7.37617910e-10, 6.98061894e-10,
       6.60579478e-10, 6.25064583e-10, 5.91416415e-10, 5.59539209e-10,
       5.29341988e-10, 5.00738323e-10, 4.73646122e-10, 4.47987410e-10,
       4.23688134e-10, 4.00677966e-10, 3.78890127e-10, 3.58261207e-10,
       3.38731003e-10, 3.20242362e-10, 3.02741028e-10, 2.86175500e-10,
       2.70496897e-10, 2.55658827e-10, 2.41617266e-10, 2.28330436e-10,
       2.15758700e-10, 2.03864447e-10, 1.92611999e-10, 1.81967510e-10,
       1.71898875e-10, 1.62375644e-10, 1.53368936e-10, 1.44851365e-10,
       1.36796960e-10, 1.29181097e-10, 1.21980430e-10, 1.15172825e-10,
       1.08737300e-10, 1.02653968e-10, 9.69039781e-11, 9.14694649e-11,
       8.63334981e-11, 8.14800350e-11, 7.68938743e-11, 7.25606138e-11,
       6.84666093e-11, 6.45989355e-11, 6.09453493e-11, 5.74942546e-11,
       5.42346689e-11, 5.11561918e-11, 4.82489747e-11, 4.55036924e-11,
       4.29115159e-11, 4.04640868e-11, 3.81534924e-11, 3.59722431e-11,
       3.39132500e-11, 3.19698037e-11, 3.01355552e-11, 2.84044963e-11,
       2.67709422e-11, 2.52295142e-11, 2.37751238e-11, 2.24029575e-11,
       2.11084620e-11, 1.98873307e-11, 1.87354905e-11, 1.76490896e-11,
       1.66244856e-11, 1.56582345e-11, 1.47470801e-11, 1.38879439e-11])

In [315]:
fig,axes=plt.subplots()

axes.plot(x,f(x),'ro',label="Fonction x")
axes.set_xlim(-2,4)
axes.set_ylim(-1,2)

fig.savefig("Graphique1.png")



In [316]:
fig,axes=plt.subplots(1,2)

axes[0].plot(x,f(x))
axes[1].plot(x,-f(x),'r')


Out[316]:
[<matplotlib.lines.Line2D at 0x1609c492e48>]

In [317]:
axes


Out[317]:
array([<matplotlib.axes._subplots.AxesSubplot object at 0x000001609A737390>,
       <matplotlib.axes._subplots.AxesSubplot object at 0x000001609C460EF0>],
      dtype=object)

In [318]:
x = np.random.randn(100)
y = np.random.randn(100)

s = 20*np.random.randn(100)
c=np.random.randn(100)

plt.scatter(x,y,s,c)


C:\Users\Agnès\Anaconda3\lib\site-packages\matplotlib\collections.py:853: RuntimeWarning: invalid value encountered in sqrt
  scale = np.sqrt(self._sizes) * dpi / 72.0 * self._factor
Out[318]:
<matplotlib.collections.PathCollection at 0x1609c4ff470>

In [319]:
x =np.linspace(-2,2)
y = np.linspace(-2,2)

xx,yy=np.meshgrid(x,y)

In [ ]:
xx,yy

In [ ]:
def g(x,y):
    return np.cos(x)+np.sin(y)**2

In [ ]:
zz=g(xx,yy)

In [ ]:
gof,axes=plt.subplots()
axes.contour(xx,yy,zz)

In [ ]:
def f(x,A,B):
    return np.exp(-B*x**2)

In [ ]:
integrate.quad(f,0,5,args=(1.0,1.0))

In [ ]:
from scipy import integrate

In [ ]:
def f(x,t):
    return -x

In [ ]:
x0=1.0

In [ ]:
t =np.linspace(0,3)

In [ ]:
sol = integrate.odeint(f,x0,t)

In [ ]:
plt.plot(t,sol)

In [ ]:
def f(x,t):
    return np.array([x[1],-x[0]])

In [ ]:
t = np.linspace(0,10)
t

In [ ]:
x0=np.array([1.0,0.0])
x0

In [ ]:
sol =integrate.odeint(f,x0,t)

In [ ]:
plt.plot(t, sol[:, 0])
plt.plot(t,sol[:,1],"--")

In [ ]:
from scipy import optimize

In [ ]:
def F(E,e, M):
    return E- e*np.sin(E)-M

In [ ]:
optimize.root(F,0.1, args=(0.016,0.1))

In [ ]:
from scipy import interpolate

In [ ]:
from scipy.interpolate import barycentric_interpolate
from numpy.polynomial import chebyshev
from scipy.interpolate import InterpolatedUnivariateSpline

In [ ]:
def fonction(x,A,B,C):
    return A*np.exp(-B*x**2)+C

In [ ]:
datos = {"Nombre":["Agnès","Julie","Daisy","Christien"],"Qualifications": ["100","90","100","80"],"Deportes " :["Football","Natation","Rugby","Basketball"],"Matières ": ["Méthodes","Cuisiner","Chimie","Manger"] }

In [ ]:
df=pd.DataFrame(datos)

In [ ]:
print(df)

In [ ]:
print('\n'*2)

In [ ]:
datos2 = {"Nombre":["Agnès","Julie","Daisy","Christien"],"Qualifications": ["100","90",np.nan,"80"],"Deportes " :["Football","N/A","Rugby","Basketball"],"Matières ": ["Méthodes","N/A","Chimie","Manger"] }

In [ ]:
df2=pd.DataFrame(datos2)

In [ ]:
print(df2)
print('\n'*2)
print(df2.info())

In [ ]:
nuevo = pd.DataFrame(df2)
nuevo = nuevo.dropna(how='any',inplace=True)
print(nuevo)

In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]: